import React from 'react'

import { useAppContext } from "../context"

export default function G() {
  const {context, setContext} = useAppContext()

  const reset=()=>{
    setContext({user: {name:"undefined", age:100}})
  }

  return (
    <div className="G">
      <p>G组件,接收到数据:<br/>
      <span>{context?.user?.name}-{context?.user?.age}</span>
      </p>
      <p>
        <button onClick={reset}>reset</button>
      </p>
    </div>
  )
}
